<template>
	<view class="content">
		<view class="title">请选择所在区域</view>
		<view class="list-block">
			<view class="list-item" :class="item.value==current?'active':''" v-for="item in list" :key="item.value"
				@click="handleChange(item)">{{item.text}}</view>
		</view>
	</view>
</template>

<script>
	import {
		getStorage,
		setStorage
	} from '@/util/auth';
	import config from '@/config.js';
	export default {
		data() {
			return {
				list: config.area[0].children[0].children,
				current: getStorage('area').value
			}
		},
		methods: {
			handleChange(data) {
				setStorage('area', data);
				uni.$emit('areaChange', data);
				this.back()
			}
		}
	}
</script>

<style lang="scss">
	.content {
		padding: 30rpx;

		.title {
			color: #999;
			margin-bottom: 30rpx;
		}

		.list-block {
			width: 100%;
			display: flex;
			flex-wrap: wrap;

			.list-item {
				width: calc((100% - 30rpx) /2);
				height: 80rpx;
				font-size: 28rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				background: #fff;
				border-radius: 5px;
				margin-bottom: 30rpx;
				margin-right: 20rpx;
				box-shadow: 0 0 6px 0 #d2d2d2;
			}

			.list-item:nth-child(2n) {
				margin-right: 0;
			}

			.list-item.active {
				color: #fff;
				background: linear-gradient(to right, #0256FF, #17baff);
			}
		}
	}
</style>